import { createBrowserRouter } from 'react-router-dom'
import App from '../App'
const router = createBrowserRouter([
  {
    path: "/",
    element: <App></App>,
    children: [
      {
        path: "home",
        lazy: async () => {
          const { default: Home } = await import("../path/home/Index");
          return { element: <Home></Home> };
        },
      },
      {
        path: "index",
        lazy: async () => {
          const { default: Index } = await import("../path/index/Index");
          return { element: <Index></Index> };
        },
      },
      {
        path: "order",
        lazy: async () => {
          const { default: Order } = await import("../path/order/Index");
          return { element: <Order></Order> };
        },
      },
      {
        path: "user",
        lazy: async () => {
          const { default: User } = await import("../path/user/Index");
          return { element: <User></User> };
        },
      },
      {
        path: "my",
        lazy: async () => {
          const { default: My } = await import("../path/my/Index");
          return { element: <My></My> };
        },
      },
    ],
    },
    {
        path: '/crty',
        lazy: async () => {
            const { default: Crty ,loader} = await import('../path/crty/Index')
            return {element:<Crty></Crty>, loader}
        }
      
  },
  {
    path: "/login",
    lazy: async () => {
      const { default: Login } = await import("../path/login/Index");
      return { element: <Login></Login> };
    },
  },
  {
    path: "*",
    lazy: async () => {
      const { default: Error } = await import("../path/404/Index");
      return { element: <Error></Error> };
    },
  },
]);
export default router